#include "EnemyOwnedStates.h"
#include "Enemy.h"
//#include "MessageDispatcher.h"
//#include "ConsoleUtils.h"
//#include "MessageTypes.h"
//#include "EntityNames.h"
#include "EntityManager.h"

#include <iomanip>
#include <iostream>
#include <cstdlib>
#include <ctime>

using namespace std;

//Define Extra Colors
#define FOREGROUND_WHITE	0x000F	//text color contains white
#define FOREGROUND_YELLOW	0x000E	//text color contains yellow

EnemyGlobalState* EnemyGlobalState::Instance()
{
	static EnemyGlobalState instance;
	return &instance;
}

void EnemyGlobalState::Execute(Enemy* immortal)
{
	
}

//bool EnemyGlobalState::OnMessage(Immortal* immortal, const Telegram& msg) 
//{
//	return false;
//}


/////////////////////////////////////////////////////////////////////////////////
//                                  DECLARE STATES
/////////////////////////////////////////////////////////////////////////////////

/* STANDARD STATE */

Standard* Standard::Instance()
{
	static Standard instance;

	return &instance;
}

void Standard::Enter(Enemy *immortal)
{
	
	
	
}

void Standard::Execute(Enemy *immortal)
{
	
	/*immortal->UpdateStrength(15);
	immortal->UpdateHealth(10);

	 SetTextColor(FOREGROUND_GREEN|FOREGROUND_INTENSITY);
	 cout<<endl<<setw(5)<<GetNameOfEntity(immortal->ID())<<": Meditating";

	if(immortal->GetWait() == 5)
	{
		cout << endl << "Attacking Opponent ";
		
		immortal->GetFSM()->ChangeState(Attack::Instance());
	}

	immortal->UpdateWait(1);*/
}

void Standard::Exit(Enemy *immortal)
{
	//immortal->SetWait(0);
}

//bool Attack::OnMessage(Enemy* immortal, const Telegram& msg)
//{
//	
//	SetTextColor(BACKGROUND_RED|FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE);
//
//	switch(msg.Msg)
//	{
//		case Msg_Help:    
//		{
//	   cout << endl << "Message handled by " << GetNameOfEntity(immortal->ID());
//
//        SetTextColor(FOREGROUND_GREEN|FOREGROUND_INTENSITY);
//
//		if (immortal->GetWait() == 5)
//		{
//		 cout << endl << GetNameOfEntity(immortal->ID()) << 
//          " helping Friend " << GetNameOfEntity(immortal->GetFID());
//		 immortal->GetFSM()->ChangeState(Help::Instance());
//		}
//		else
//		{
//			cout << endl << GetNameOfEntity(immortal->ID()) << 
//			": can't help yet ";
//		}
//	
//		}
//		return true;
//
//		case Msg_Attack:    
//		{
//	   cout << endl << "Message handled by " << GetNameOfEntity(immortal->ID());
//
//        SetTextColor(FOREGROUND_GREEN|FOREGROUND_INTENSITY);
//
//		 cout << endl << GetNameOfEntity(immortal->ID()) << 
//          ": no effect ";
//
//	
//		}
//		return true;
// 
//	 }//end switch
//	return false;
//}









/*   STATE */

